import SwiftUI

@MainActor
@Observable  final class MoviesViewModel {
    var movies: [Movie] = []
    
  
    @ObservationIgnored
    private let coordinator: MoviesCoordinator

    
    init( coordinator: MoviesCoordinator) {
        self.coordinator = coordinator
    }
    
    func fetch() async {
        movies = await UseCaseData.asyncGetMovies()
    }
    
    
    func didSelect(movie: Movie) {
        coordinator.showDetail(for: movie)
    }

    
}
